package camel.first.api.datastore.internal.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;

/**
 * User: yuxinlei
 * Date: 4/13/11
 * Time: 1:51 PM
 */
@javax.persistence.Table(name = "coverage", catalog = "reportdb")
@Entity
public class CoverageEntity {
    private int buildId;

    @javax.persistence.Column(name = "build_id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public int getBuildId() {
        return buildId;
    }

    public void setBuildId(int buildId) {
        this.buildId = buildId;
    }

    private float rdFuncCov;

    @javax.persistence.Column(name = "rd_func_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getRdFuncCov() {
        return rdFuncCov;
    }

    public void setRdFuncCov(float rdFuncCov) {
        this.rdFuncCov = rdFuncCov;
    }

    private float qaFuncCov;

    @javax.persistence.Column(name = "qa_func_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getQaFuncCov() {
        return qaFuncCov;
    }

    public void setQaFuncCov(float qaFuncCov) {
        this.qaFuncCov = qaFuncCov;
    }

    private float rdCdCov;

    @javax.persistence.Column(name = "rd_cd_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getRdCdCov() {
        return rdCdCov;
    }

    public void setRdCdCov(float rdCdCov) {
        this.rdCdCov = rdCdCov;
    }

    private float qaCdCov;

    @javax.persistence.Column(name = "qa_cd_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getQaCdCov() {
        return qaCdCov;
    }

    public void setQaCdCov(float qaCdCov) {
        this.qaCdCov = qaCdCov;
    }

    private float rdLineCov;

    @javax.persistence.Column(name = "rd_line_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getRdLineCov() {
        return rdLineCov;
    }

    public void setRdLineCov(float rdLineCov) {
        this.rdLineCov = rdLineCov;
    }

    private float qaLineCov;

    @javax.persistence.Column(name = "qa_line_cov", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getQaLineCov() {
        return qaLineCov;
    }

    public void setQaLineCov(float qaLineCov) {
        this.qaLineCov = qaLineCov;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CoverageEntity that = (CoverageEntity) o;

        if (buildId != that.buildId) return false;
        if (Float.compare(that.qaCdCov, qaCdCov) != 0) return false;
        if (Float.compare(that.qaFuncCov, qaFuncCov) != 0) return false;
        if (Float.compare(that.qaLineCov, qaLineCov) != 0) return false;
        if (Float.compare(that.rdCdCov, rdCdCov) != 0) return false;
        if (Float.compare(that.rdFuncCov, rdFuncCov) != 0) return false;
        if (Float.compare(that.rdLineCov, rdLineCov) != 0) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = buildId;
        result = 31 * result + (rdFuncCov != +0.0f ? Float.floatToIntBits(rdFuncCov) : 0);
        result = 31 * result + (qaFuncCov != +0.0f ? Float.floatToIntBits(qaFuncCov) : 0);
        result = 31 * result + (rdCdCov != +0.0f ? Float.floatToIntBits(rdCdCov) : 0);
        result = 31 * result + (qaCdCov != +0.0f ? Float.floatToIntBits(qaCdCov) : 0);
        result = 31 * result + (rdLineCov != +0.0f ? Float.floatToIntBits(rdLineCov) : 0);
        result = 31 * result + (qaLineCov != +0.0f ? Float.floatToIntBits(qaLineCov) : 0);
        return result;
    }

    private BuildsEntity buildsByBuildId;

    @OneToOne
    public
    @javax.persistence.JoinColumn(name = "build_id", referencedColumnName = "id", nullable = false)
    BuildsEntity getBuildsByBuildId() {
        return buildsByBuildId;
    }

    public void setBuildsByBuildId(BuildsEntity buildsByBuildId) {
        this.buildsByBuildId = buildsByBuildId;
    }
}
